
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>SystembarTint · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.2">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="permission-ask.html" />
    
    
    <link rel="prev" href="component.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        <li class="header">----安卓 UI----</li>
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="view.html">
            
                <a href="view.html">
            
                    
                    自定义控件和measure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="canvas-paint.html">
            
                <a href="canvas-paint.html">
            
                    
                    draw和canvas，paint详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="anim.html">
            
                <a href="anim.html">
            
                    
                    动画
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="notify.html">
            
                <a href="notify.html">
            
                    
                    notify系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="loading.html">
            
                <a href="loading.html">
            
                    
                    loading系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="status-ui.html">
            
                <a href="status-ui.html">
            
                    
                    StatusUI系列库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="touch-scroll.html">
            
                <a href="touch-scroll.html">
            
                    
                    滑动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="layout.html">
            
                <a href="layout.html">
            
                    
                    Layout
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="textview.html">
            
                <a href="textview.html">
            
                    
                    TextView
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="drawable.html">
            
                <a href="drawable.html">
            
                    
                    Drawable
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="item-template.html">
            
                <a href="item-template.html">
            
                    
                    列表Adapter模板化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="recyclerview.html">
            
                <a href="recyclerview.html">
            
                    
                    RecyclerView全解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="design.html">
            
                <a href="design.html">
            
                    
                    MeterialDesign详解
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="component.html">
            
                <a href="component.html">
            
                    
                    AyoComponent基础库--Activity和Fragment
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.16" data-path="systembartint.html">
            
                <a href="systembartint.html">
            
                    
                    SystembarTint
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="permission-ask.html">
            
                <a href="permission-ask.html">
            
                    
                    权限控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="keyboard.html">
            
                <a href="keyboard.html">
            
                    
                    小键盘
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="notification.html">
            
                <a href="notification.html">
            
                    
                    Notification
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----安卓 foundation----</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="mvp.html">
            
                <a href="mvp.html">
            
                    
                    MVP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="rxjava.html">
            
                <a href="rxjava.html">
            
                    
                    RxJava
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="lang.html">
            
                <a href="lang.html">
            
                    
                    常用工具类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="http.html">
            
                <a href="http.html">
            
                    
                    http
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="xml.html">
            
                <a href="xml.html">
            
                    
                    xml解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="json-reporter.html">
            
                <a href="json-reporter.html">
            
                    
                    Json解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="inject.html">
            
                <a href="inject.html">
            
                    
                    ButterKnife
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="thread.html">
            
                <a href="thread.html">
            
                    
                    安卓线程和looper
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="process.html">
            
                <a href="process.html">
            
                    
                    多进程
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="eventbus.html">
            
                <a href="eventbus.html">
            
                    
                    EventBus
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="db.html">
            
                <a href="db.html">
            
                    
                    数据库和ContentProvider
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="job.html">
            
                <a href="job.html">
            
                    
                    定时任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="service.html">
            
                <a href="service.html">
            
                    
                    service
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="opt-mem.html">
            
                <a href="opt-mem.html">
            
                    
                    内存优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="opt-network.html">
            
                <a href="opt-network.html">
            
                    
                    网络优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="opt-anr.html">
            
                <a href="opt-anr.html">
            
                    
                    anr排查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="opt-ui.html">
            
                <a href="opt-ui.html">
            
                    
                    UI卡顿优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    启动优化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="opt-launch.html">
            
                <a href="opt-launch.html">
            
                    
                    混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="hotfix.html">
            
                <a href="hotfix.html">
            
                    
                    热补丁混淆
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.21" data-path="aar.html">
            
                <a href="aar.html">
            
                    
                    aar相关
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.22" data-path="route.html">
            
                <a href="route.html">
            
                    
                    Route路由
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="2.23" data-path="modules.html">
            
                <a href="modules.html">
            
                    
                    分模块，组件化，插件化
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----Gradle----</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="gradle.html">
            
                <a href="gradle.html">
            
                    
                    gradle基本配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="gradle-plugin.html">
            
                <a href="gradle-plugin.html">
            
                    
                    gradle插件开发
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">----工具----</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="repos.html">
            
                <a href="repos.html">
            
                    
                    优秀博客，开源项目
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="packs.html">
            
                <a href="packs.html">
            
                    
                    自动打包，多渠道打包
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="gist.html">
            
                <a href="gist.html">
            
                    
                    代码片段和常见问题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="stetho.html">
            
                <a href="stetho.html">
            
                    
                    stetho
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="fabric.html">
            
                <a href="fabric.html">
            
                    
                    fabric
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="app-update.html">
            
                <a href="app-update.html">
            
                    
                    自动升级
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.7" data-path="bugsnags.html">
            
                <a href="bugsnags.html">
            
                    
                    日志和崩溃统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.8" data-path="mail.html">
            
                <a href="mail.html">
            
                    
                    发邮件辅助接口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.9" data-path="socail.html">
            
                <a href="socail.html">
            
                    
                    第三方登录和分享
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.10" data-path="pay-alipay.html">
            
                <a href="pay-alipay.html">
            
                    
                    支付宝支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.11" data-path="pay-wx.html">
            
                <a href="pay-wx.html">
            
                    
                    微信支付
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.12" data-path="umeng.html">
            
                <a href="umeng.html">
            
                    
                    友盟统计
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.13" data-path="push-jpush.html">
            
                <a href="push-jpush.html">
            
                    
                    推送-极光
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.14" data-path="push-xiaomi.html">
            
                <a href="push-xiaomi.html">
            
                    
                    推送-小米
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >SystembarTint</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="systembartint">SystembarTint</h1>
<p>github&#x5730;&#x5740;&#xFF1A;<a href="https://github.com/cowthan/AyoCompoment" target="_blank">https://github.com/cowthan/AyoCompoment</a></p>
<h2 id="7-&#x72B6;&#x6001;&#x680F;&#x4E00;&#x4F53;&#x5316;">7 &#x72B6;&#x6001;&#x680F;&#x4E00;&#x4F53;&#x5316;</h2>
<pre><code>&#x6CE8;&#x610F;&#xFF0C;&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x603B;&#x662F;&#x5F97;&#x4E00;&#x5757;&#x7528;&#xFF0C;&#x4E0D;&#x8981;&#x5355;&#x72EC;&#x7528;
///status bar&#x548C;navigate bar&#x7684;&#x989C;&#x8272;&#xFF0C;&#x5982;&#x679C;&#x662F;&#x6D45;&#x8272;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x914D;&#x5408;SystamBarExtra&#x91CC;&#x7684;&#x65B9;&#x6CD5;&#x52A0;&#x4EE5;&#x4F18;&#x5316;&#xFF0C;&#x4F46;&#x4E0D;&#x652F;&#x6301;&#x4E09;&#x661F;&#x624B;&#x673A;
getAgent().renderSystemBar(Color.YELLOW, Color.GREEN);
///status bar&#x548C;navigate bar&#x662F;&#x5426;&#x88AB;&#x4FB5;&#x5360;
getAgent().enableSystemBarTakenByContent(false);


&#x8FD9;&#x4E24;&#x4E2A;&#x65B9;&#x6CD5;&#x5176;&#x5B9E;&#x662F;&#x5BF9;&#x5E94;&#x7740;&#x4E3B;&#x9898;&#x91CC;&#x7684;&#xFF1A;
&lt;item name=&quot;colorPrimary&quot;&gt;@color/colorPrimary&lt;/item&gt;
&lt;item name=&quot;colorPrimaryDark&quot;&gt;@color/colorPrimaryDark&lt;/item&gt;
&lt;item name=&quot;colorAccent&quot;&gt;@color/colorAccent&lt;/item&gt;
&#x548C;&#x5E03;&#x5C40;&#x91CC;&#x7684;&#xFF1A;
fitSystemWindow=&quot;true&quot;

&#x5F53;&#x7136;&#xFF0C;&#x4EE3;&#x7801;&#x91CC;&#x8BBE;&#x7F6E;&#x7684;&#x4F18;&#x5148;&#x7EA7;&#x6BD4;&#x8F83;&#x9AD8;
</code></pre><p>&#x4E0B;&#x9762;&#x591A;&#x8BF4;&#x70B9;&#xFF0C;systembar&#x6D89;&#x53CA;&#x5230;&#x4E24;&#x4E2A;&#x95EE;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x95EE;&#x9898;1&#xFF1A;&#x989C;&#x8272;&#x8BBE;&#x7F6E;&#xFF0C;&#x53EF;&#x4EE5;&#x5F00;&#x542F;&#x548C;&#x5173;&#x95ED;&#xFF0C;&#x5206;status bar&#x548C;navigation bar</li>
<li>&#x95EE;&#x9898;2&#xFF1A;&#x662F;&#x5426;&#x4FB5;&#x5165;&#xFF0C;&#x53EF;&#x4EE5;&#x5F00;&#x542F;&#x548C;&#x5173;&#x95ED;&#xFF0C;&#x548C;&#x989C;&#x8272;&#x8BBE;&#x7F6E;&#x4E0D;&#x51B2;&#x7A81;</li>
</ul>
<p>&#x4EE3;&#x7801;&#xFF1A;</p>
<pre><code class="lang-java"><span class="hljs-meta">@Override</span>
<span class="hljs-function"><span class="hljs-keyword">protected</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onCreate</span><span class="hljs-params">(Bundle savedInstanceState)</span> </span>{
    <span class="hljs-keyword">super</span>.onCreate(savedInstanceState);
    setContentView(R.layout.sample_ac_main);

    <span class="hljs-comment">//&#x5173;&#x95ED;StatusBar&#x548C;NavigationBar&#x4FB5;&#x5165;</span>
    getAgent().enableSystemBarTakenByContent(<span class="hljs-keyword">false</span>);

    <span class="hljs-comment">//&#x7ED9;StatusBar&#x548C;NavigaionBar&#x67D3;&#x8272;</span>
    getAgent().renderSystemBar(Color.parseColor(<span class="hljs-string">&quot;#55ff0000&quot;</span>), Color.parseColor(<span class="hljs-string">&quot;#55ff0000&quot;</span>));

}
</code></pre>
<ul>
<li>&#x89E3;&#x6790;&#xFF1A;<ul>
<li>&#x8FD9;&#x91CC;&#x5C31;&#x662F;&#x5BF9;&#x5F00;&#x6E90;&#x4EE3;&#x7801;SystemBarTintManager&#x7684;&#x7B80;&#x5355;&#x5C01;&#x88C5;</li>
<li>enableSystemBarTakenByContent&#x5176;&#x5B9E;&#x5C31;&#x662F;&#x8BBE;&#x7F6E;&#x6839;&#x5E03;&#x5C40;&#x7684;<code>android:fitsSystemWindows</code>&#x5C5E;&#x6027;</li>
</ul>
</li>
</ul>
<p>fitSystemWindows&#x662F;true&#x65F6;&#xFF1A;enableSystemBarTakenByContent(false)&#xFF0C;&#x5185;&#x5BB9;&#x7ED9;SystemBar&#x7559;&#x7A7A;
<img src="img/mm2.png" alt=""></p>
<p>fitSystemWindows&#x662F;false&#x65F6;&#xFF1A;enableSystemBarTakenByContent(true)&#xFF0C;&#x5185;&#x5BB9;&#x4FB5;&#x5165;SystemBar
<img src="img/mm3.png" alt=""></p>
<p>&#x5176;&#x4ED6;&#x95EE;&#x9898;&#xFF1A;</p>
<ul>
<li>&#x5173;&#x4E8E;clipToPadding&#x548C;clipToChildren&#xFF1A;&#x9ED8;&#x8BA4;&#x90FD;&#x4E3A;true</li>
<li><a href="http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0317/2613.html" target="_blank">http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0317/2613.html</a></li>
<li>&#x597D;&#x50CF;&#x548C;&#x6EDA;&#x52A8;&#x6709;&#x5173;&#xFF0C;&#x53EF;&#x4EE5;&#x4E0A;&#x4E0B;&#x6EDA;&#x52A8;&#x65F6;&#xFF0C;&#x5185;&#x5BB9;&#x662F;&#x5426;&#x53EF;&#x4EE5;&#x6EDA;&#x52A8;&#x5230;&#x6807;&#x9898;&#x680F;&#x91CC;</li>
</ul>
<pre><code>&lt;ListView
    android:layout_gravity=&quot;center_vertical&quot;
    android:id=&quot;@+id/list&quot;
    android:clipChildren=&quot;false&quot;
    android:clipToPadding=&quot;false&quot;
    android:paddingTop=&quot;50dip&quot;
    android:layout_width=&quot;match_parent&quot;
    android:layout_height=&quot;match_parent&quot; /&gt;
</code></pre><p>ListView&#x521D;&#x59CB;&#x5316;&#x4E4B;&#x540E;&#xFF0C;&#x7531;&#x4E8E;top&#x7684;50dp&#x7684;padding&#xFF0C;&#x770B;&#x4F3C;&#x9876;&#x7740;&#x6807;&#x9898;&#x680F;&#xFF0C;&#x4F46;&#x5F80;&#x4E0A;&#x6EDA;&#x52A8;&#x65F6;&#xFF0C;&#x5185;&#x5BB9;&#x5C31;&#x4F1A;&#x8DD1;&#x5230;padding&#x7684;50dp&#x91CC;&#xFF0C;&#x4E5F;&#x5C31;&#x80FD;&#x4ECE;&#x6807;&#x9898;&#x680F;&#x770B;&#x5230;&#x4E86;&#xFF08;&#x5982;&#x679C;&#x6807;&#x9898;&#x680F;&#x5E26;&#x900F;&#x660E;&#xFF09;</p>
<p>&#x5B9E;&#x9645;&#x7528;&#x4F8B;&#xFF0C;&#x8FD8;&#x5F97;&#x8003;&#x8651;systembar&#x7684;&#x80CC;&#x666F;&#x53D8;&#x6210;&#x6D45;&#x8272;&#x65F6;&#xFF0C;&#x5B57;&#x4F53;&#x989C;&#x8272;&#x7684;&#x95EE;&#x9898;&#xFF0C;&#x4F46;&#x4E09;&#x661F;&#x624B;&#x673A;&#x597D;&#x50CF;&#x4E0D;&#x592A;&#x652F;&#x6301;&#x72B6;&#x6001;&#x680F;&#x80CC;&#x666F;&#x6D45;&#x8272;&#xFF08;&#x4F1A;&#x53D8;&#x6210;&#x7070;&#x8272;&#x4EE3;&#x66FF;&#xFF09;</p>
<pre><code class="lang-java"><span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">void</span> <span class="hljs-title">breakerSystemBar</span><span class="hljs-params">(AyoActivity a)</span></span>{
    a.agent.enableSystemBarTakenByContent(<span class="hljs-keyword">false</span>);
    a.agent.renderSystemBar(Color.WHITE, Color.WHITE);

    <span class="hljs-comment">/// &#x4E0B;&#x9762;&#x8FD9;&#x4E09;&#x4E2A;&#x63A7;&#x5236;&#x72B6;&#x6001;&#x680F;&#x5B57;&#x4F53;&#x989C;&#x8272;&#xFF0C;&#x5206;&#x522B;&#x7BA1;&#xFF1A;6.0&#xFF0C; MIUI&#xFF0C;&#x9B45;&#x65CF;&#x7CFB;&#x7EDF;----&#x5F53;systembar&#x7684;&#x80CC;&#x666F;&#x88AB;&#x8BBE;&#x7F6E;&#x6210;&#x6D45;&#x8272;&#xFF0C;&#x5B57;&#x4F53;&#x5C31;&#x5F97;&#x53D8;&#x6210;&#x6DF1;&#x8272;&#xFF08;&#x4E00;&#x822C;&#x60C5;&#x51B5;&#x4E0B;&#x80CC;&#x666F;&#x662F;&#x6DF1;&#x8272;&#xFF0C;&#x5B57;&#x4F53;&#x9ED8;&#x8BA4;&#x662F;&#x6D45;&#x8272;&#xFF09;</span>
    <span class="hljs-keyword">if</span> (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M) {
        a.getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    }
    MIUISetStatusBarLightMode(a.getWindow(), <span class="hljs-keyword">true</span>);
    FlymeSetStatusBarLightMode(a.getWindow(), <span class="hljs-keyword">true</span>);

}

<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">MIUISetStatusBarLightMode</span><span class="hljs-params">(Window window, <span class="hljs-keyword">boolean</span> dark)</span> </span>{
    <span class="hljs-keyword">boolean</span> result = <span class="hljs-keyword">false</span>;
    <span class="hljs-keyword">if</span> (window != <span class="hljs-keyword">null</span>) {
        Class clazz = window.getClass();
        <span class="hljs-keyword">try</span> {
            <span class="hljs-keyword">int</span> darkModeFlag = <span class="hljs-number">0</span>;
            Class layoutParams = Class.forName(<span class="hljs-string">&quot;android.view.MiuiWindowManager$LayoutParams&quot;</span>);
            Field field = layoutParams.getField(<span class="hljs-string">&quot;EXTRA_FLAG_STATUS_BAR_DARK_MODE&quot;</span>);
            darkModeFlag = field.getInt(layoutParams);
            Method extraFlagField = clazz.getMethod(<span class="hljs-string">&quot;setExtraFlags&quot;</span>, <span class="hljs-keyword">int</span>.class, <span class="hljs-keyword">int</span>.class);
            <span class="hljs-keyword">if</span>(dark){
                extraFlagField.invoke(window,darkModeFlag,darkModeFlag);<span class="hljs-comment">//&#x72B6;&#x6001;&#x680F;&#x900F;&#x660E;&#x4E14;&#x9ED1;&#x8272;&#x5B57;&#x4F53;</span>
            }<span class="hljs-keyword">else</span>{
                extraFlagField.invoke(window, <span class="hljs-number">0</span>, darkModeFlag);<span class="hljs-comment">//&#x6E05;&#x9664;&#x9ED1;&#x8272;&#x5B57;&#x4F53;</span>
            }
            result=<span class="hljs-keyword">true</span>;
        }<span class="hljs-keyword">catch</span> (Exception e){

        }
    }
    <span class="hljs-keyword">return</span> result;
}

<span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">static</span> <span class="hljs-keyword">boolean</span> <span class="hljs-title">FlymeSetStatusBarLightMode</span><span class="hljs-params">(Window window, <span class="hljs-keyword">boolean</span> dark)</span> </span>{
    <span class="hljs-keyword">boolean</span> result = <span class="hljs-keyword">false</span>;
    <span class="hljs-keyword">if</span> (window != <span class="hljs-keyword">null</span>) {
        <span class="hljs-keyword">try</span> {
            WindowManager.LayoutParams lp = window.getAttributes();
            Field darkFlag = WindowManager.LayoutParams.class
                    .getDeclaredField(<span class="hljs-string">&quot;MEIZU_FLAG_DARK_STATUS_BAR_ICON&quot;</span>);
            Field meizuFlags = WindowManager.LayoutParams.class
                    .getDeclaredField(<span class="hljs-string">&quot;meizuFlags&quot;</span>);
            darkFlag.setAccessible(<span class="hljs-keyword">true</span>);
            meizuFlags.setAccessible(<span class="hljs-keyword">true</span>);
            <span class="hljs-keyword">int</span> bit = darkFlag.getInt(<span class="hljs-keyword">null</span>);
            <span class="hljs-keyword">int</span> value = meizuFlags.getInt(lp);
            <span class="hljs-keyword">if</span> (dark) {
                value |= bit;
            } <span class="hljs-keyword">else</span> {
                value &amp;= ~bit;
            }
            meizuFlags.setInt(lp, value);
            window.setAttributes(lp);
            result = <span class="hljs-keyword">true</span>;
        } <span class="hljs-keyword">catch</span> (Exception e) {

        }
    }
    <span class="hljs-keyword">return</span> result;
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="component.html" class="navigation navigation-prev " aria-label="Previous page: AyoComponent基础库--Activity和Fragment">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="permission-ask.html" class="navigation navigation-next " aria-label="Next page: 权限控制">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"SystembarTint","level":"1.16","depth":1,"next":{"title":"权限控制","level":"1.17","depth":1,"path":"permission-ask.md","ref":"permission-ask.md","articles":[]},"previous":{"title":"AyoComponent基础库--Activity和Fragment","level":"1.15","depth":1,"path":"component.md","ref":"component.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"systembartint.md","mtime":"2017-04-09T15:06:13.865Z","type":"markdown"},"gitbook":{"version":"3.2.2","time":"2017-04-09T17:03:25.521Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

